package com.sky.service.impl;

import com.sky.mapper.ShoppingCartMapper;
import com.sky.service.ShoppingCartService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 购物车服务实现类
 */
@Service
@Slf4j
public class ShoppingCartServiceImpl implements ShoppingCartService {

    @Autowired
    private ShoppingCartMapper shoppingCartMapper;

    /**
     * 清空购物车
     * @param userId 用户ID
     */
    @Override
    public void clean(Long userId) {
        log.info("清空用户购物车：userId = {}", userId);
        shoppingCartMapper.deleteByUserId(userId);
    }
}